package com.phoenix.callAnalysis.models;

import java.text.SimpleDateFormat;
import java.util.Date;

public class MyCall {
	public static final int INCOMING_TYPE = 1;
	public static final int OUTGOING_TYPE = 2;
	public static final int MISSED_TYPE = 3;
	private String name="";
	private String numberLabel="";
	// This value is not guaranteed to be current, if the contact information
	// associated with this number has changed.
	private int numberType;
	private long occuredDate;
	private long duration;
	private int isNew;
	private String number="";
	private int type;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		if (name == null) {
			this.name = "";
		} else {
			this.name = name;
		}
	}

	public String getNumberLabel() {
		return numberLabel;
	}

	public void setNumberLabel(String numberLabel) {
		if (numberLabel == null) {
			this.numberLabel = "";
		} else {
			this.numberLabel = numberLabel;
		}
	}

	public int getNumberType() {
		return numberType;
	}

	public void setNumberType(int numberType) {
		this.numberType = numberType;
	}

	public long getOccuredDate() {
		return occuredDate;
	}

	public void setOccuredDate(long occuredDate) {
		this.occuredDate = occuredDate;
	}

	public long getDuration() {
		return duration;
	}

	public void setDuration(long duration) {
		this.duration = duration;
	}

	public int getIsNew() {
		return isNew;
	}

	public void setIsNew(int isNew) {
		this.isNew = isNew;
	}

	public String getNumber() {
		return number;
	}

	public void setNumber(String number) {
		if (number == null) {
			this.number = "";
		} else {
			this.number = number;
		}
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	@Override
	public String toString() {
		return "name: "
				+ name
				+ " - numberLabel: "
				+ numberLabel
				+ " - numberType: "
				+ numberType
				+ " - occuredDate: "
				+ new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date(
						occuredDate)) + " - duration(s): " + duration
				+ " - isNew: " + isNew + " - number: " + number + " - type: "
				+ type;
	}

	@Override
	public boolean equals(Object o) {
		MyCall call = (MyCall) o;
		if (this.name.equals(call.name)
				&& this.numberLabel.equals(call.numberLabel)
				&& this.numberType == call.numberType
				&& this.occuredDate == call.occuredDate
				&& this.duration == call.duration && this.isNew == call.isNew
				&& this.number.equals(call.number) && this.type == call.type) {
			return true;
		}
		return false;
	}

}
